home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / winmaze4.zip / HEXMAZE.H < prev    next >
C/C++ Source or Header  |  1994-05-01  |  4KB  |  123 lines

  1. #ifndef HEXMAZE_H
  2. #define HEXMAZE_H
  3.  
  4. //      Each instance of this class is a maze having hexagonal rooms.
  5.  
  6. //      This class uses the classes "cell" (room of a maze) and "oracle"
  7. // (random number generator).
  8.  
  9. class hexmaze
  10.   {
  11.     private:
  12.       oracle       *column_selector;
  13. //      Random number generator to select column to start constructing maze.
  14.  
  15.       struct
  16.         {
  17.            int row_num;
  18.            int column_num;
  19.         }          current;
  20. //      Current location in maze.
  21.  
  22.       void         draw_line_on_page(int x1,int y1,int x2,int y2);
  23. //      Draw wall (of bricks) on "page".
  24.  
  25.       struct
  26.         {
  27.            int row_num;
  28.            int column_num;
  29.         }          first;
  30. //      Location of the starting room.
  31.  
  32.       int          max_x;
  33.  
  34.       int          memory_allocated;
  35. //      The memory for the maze has been allocated.
  36.  
  37.       int          num_columns;
  38. //      Number of columns in maze.
  39.  
  40.       int          num_rows;
  41. //      Number of rows in maze.
  42.  
  43.       int          num_x_dots;
  44. //      Number of columns of bricks in maze.
  45.  
  46.       int          num_y_dots;
  47. //      Number of rows of bricks in maze.
  48.  
  49.       oracle       *order_selector;
  50. //      Random number generator to select the order walls are to considered.
  51.  
  52.       char         **page;
  53. //      Two dimensional plot of maze, one element per possible brick position.
  54. // 'W' if brick is present; ' ' otherwise.
  55.  
  56.       cell         **room;
  57. //      Two dimensional array of rooms composing the maze.
  58.  
  59.       oracle       *row_selector;
  60. //      Random number generator to select row to start constructing maze.
  61.  
  62.       void         set_point_on_page(int x,int y);
  63. //      Place a section of wall on "page".  Each section is "wall_thickness"
  64. // bricks long and "wall_thickness" bricks wide.
  65.  
  66.       int          wall_thickness;
  67. //      Thickness of wall in "bricks".
  68.  
  69.       TFrameWindow *window_ptr;
  70.  
  71.       int          x_dot_max;
  72. //      num_x_dots-1
  73.  
  74.       int          y_dot_max;
  75. //      num_y_dots-1
  76.  
  77.     public:
  78.  
  79.       int    constructed(void) {return memory_allocated;}
  80. //      Return TRUE if and only if the maze is successfully constructed.
  81.  
  82.       int    external_to_maze(double x,double y);
  83. //      Return TRUE if and only if a point (x,y) is external to the maze.
  84.  
  85.       double f(double x,double y);
  86. //      Return 5.0*wall_thickness if a point (x,y) is on a wall, 0.0 otherwise.
  87.  
  88.              hexmaze(int row_count,int column_count,int thickness_of_wall,
  89.               char *seed,TFrameWindow *win_ptr);
  90. //      Contruct a maze having "row_count" rows and "column_count" columns of
  91. // rooms.  The walls should be "thickness_of_wall" (bricks) thick.  A different
  92. // (8 character of less) "seed" generally yields a different maze.
  93.  
  94.              ~hexmaze(void);
  95.  
  96.       int    maze_okay(void);
  97. //      TRUE if and only if solving the maze is difficult enough.
  98.  
  99.       int    num_x_divisions(void) {return num_y_dots+2;}
  100. //      Recommended number of x divisions for plotting f(x,y).
  101.  
  102.       int    num_y_divisions(void) {return num_x_dots+2;}
  103. //      Recommended number of y divisions for plotting f(x,y).
  104.  
  105.       int    part_of_solution(double x,double y);
  106. //      Return TRUE if and only if a point (x,y) is on a wall outlining the
  107. // solution to the maze.
  108.  
  109.       double x_max(void) {return double(num_y_dots);}
  110. //      Recommended maximum value of x for plotting f(x,y).
  111.  
  112.       double x_min(void) {return(-1.0);}
  113. //      Recommended minimum value of x for plotting f(x,y).
  114.  
  115.       double y_max(void) {return double(num_x_dots);}
  116. //      Recommended maximum value of y for plotting f(x,y).
  117.  
  118.       double y_min(void) {return(-1.0);}
  119. //      Recommended minimum value of y for plotting f(x,y).
  120.   };
  121.  
  122. #endif
  123.